package com.postracker.postracker.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import com.postracker.postracker.dao.UserDao;
import com.postracker.postracker.model.User;

public class UserDaoImpl implements UserDao {

	private Session session;

	public UserDaoImpl(Session session) {
		this.session = session;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<User> findAll() throws SQLException {
		Query query = session.createQuery("from " + User.class.getName());
		return query.list();
	}

	@Override
	public void delete(User user) {
		// TODO Auto-generated method stub

	}

	@Override
	public User saveOrUpdate(User user) {
		// TODO Auto-generated method stub
		return null;
	}

}
